/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ViewerTest.java
 *
 * Created on Nov 8, 2009, 10:27:33 AM
 */
package CoalitionCirclePackage;

import GISPackage.Region;
import GISPackage.Regions;
import java.awt.Dimension;
import java.io.File;
import java.io.IOException;

/**
 *
 * @author Heather
 */
public class ViewerTest extends javax.swing.JApplet
{

  /** Initializes the applet ViewerTest */
  public void init()
  {
    try
    {
      java.awt.EventQueue.invokeAndWait(new Runnable()
      {

        public void run()
        {
          initComponents();
          //viewerPanel = new CCPVCoalitionCircleViewerPanel("c:/CCPV Data/tests/indoformat.txt");
          //viewerPanel = new CCPVCoalitionCircleViewerPanel();
          Regions regions = new Regions();

          try
          {
            regions.loadStuctureVariables(new File("c:/CCPV Data/all structure variables.csv"));
          } catch (IOException e)
          {
            System.out.println("bah humbug");
          }

          Region Indonesia = null;
          for (Region r : regions.regions)
          {
            if (r.name.equals("Indonesia"))
            {
              Indonesia = r;
            }
          }
          if (Indonesia == null)
          {
            System.out.println("NULL!");
          }
          else
          {
          }
          viewerPanel = new CCPVCoalitionCircleViewerPanel("c:/CCPV Data/tests/indoformat.txt", Indonesia);
          container.add(viewerPanel);
          viewerPanel.setSize(panelD);
          viewerPanel.setPreferredSize(panelD);
        }
      });
    } catch (Exception ex)
    {
      ex.printStackTrace();
    }
  }

  /** This method is called from within the init() method to
   * initialize the form.
   * WARNING: Do NOT modify this code. The content of this method is
   * always regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    container = new javax.swing.JPanel();

    container.setBackground(new java.awt.Color(204, 204, 255));

    javax.swing.GroupLayout containerLayout = new javax.swing.GroupLayout(container);
    container.setLayout(containerLayout);
    containerLayout.setHorizontalGroup(
      containerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGap(0, 948, Short.MAX_VALUE)
    );
    containerLayout.setVerticalGroup(
      containerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGap(0, 612, Short.MAX_VALUE)
    );

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    );
    layout.setVerticalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    );
  }// </editor-fold>//GEN-END:initComponents
  // Variables declaration - do not modify//GEN-BEGIN:variables
  private javax.swing.JPanel container;
  // End of variables declaration//GEN-END:variables
  private CCPVCoalitionCircleViewerPanel viewerPanel;
  //private CCPVCoalitionCircleViewerPanel viewerPanel = new CCPVCoalitionCircleViewerPanel("c:/CCPV Data/tests/indoformat.txt");
  //private CCPVCoalitionCircleViewerPanel viewerPanel = new CCPVCoalitionCircleViewerPanel();
  private Dimension panelD = new Dimension(1000, 800);
}

